<%@ page import="com.study.springmvc.model.Student" %>
<%@ page import="java.util.List" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>hello world 2</title>
</head>
<body>

<p><a href="/teacher/toAdd">添加</a></p>
<form action="/teacher/list" method="get">
    <p>姓名：<input type="text" value="${param.name}" name="name"/></p>
    <p>年龄段：<input type="text" value="${param.ageBegin}" name="ageBegin"/> ~ <input type="text" value="${param.ageEnd}" name="ageEnd"/></p>
    <p>科目：<input type="text" value="${param.kemu}" name="kemu"/></p>
    <input type="submit" value="查询"/>
</form>
<table border="1">
    <tr>
        <td>ID</td>
        <td>姓名</td>
        <td>年龄</td>
        <td>科目</td>
        <td>联系电话</td>
        <td>操作</td>
    </tr>
    <c:forEach items="${teacherList}" var="stu" varStatus="stuStatus">
    <tr ${stuStatus.index % 2 == 0 ? "style=\"background-color: darkgray\"" : ""}>
        <td>${stu.id}</td>
        <td>${stu.tname}</td>
        <td>${stu.age}</td>
        <td>${stu.kemu}</td>
        <td>${stu.telephone}</td>
        <td><a href="/teacher/toUpdate?id=${stu.id}">修改</a>&nbsp;&nbsp;<a href="/teacher/delete?id=${stu.id}">删除</a></td>
    </tr>
    </c:forEach>
    <p>
        总记录数：${studentCount}
    <c:forEach begin="1" end="${pageCount}" step="1" varStatus="pageStatus">
        <a href="/teacher/list?pageIndex=${pageStatus.current}&pageSize=${pageSize}">${pageStatus.current}</a>
    </c:forEach>
    <p></p>
</table>
</body>
</html>